#ifndef _THREADPOOL_H_
#define _THREADPOOL_H_

#include "TaskQueue.h"
#include <vector>
#include <thread>

using std::vector;
using std::thread;

class ThreadPool
{
public:
    ThreadPool(size_t threadNum,size_t queSize);
    ~ThreadPool();

    void start();
    void stop();

    void addTask(Task*);

private:
    Task * getTask();
    void doTask();

private:
    size_t _threadNum;
    size_t _queSize;
    vector<thread> _threads;
    TaskQueue _taskQue;
    bool _isExit;
};

#endif
